package top.yuyufeng.sample.web;

import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.yuyufeng.sample.vo.UserVO;

import javax.servlet.http.HttpServletRequest;

/**
 * @author yuyufeng
 * @date 2018/4/19.
 */
@RestController
public class LoginController {

    @RequestMapping(value = "login")
    String doLogin(HttpServletRequest request) {
        UserVO user = new UserVO();
        user.setUserName("yyf");
        user.setUserPassword("12345");
        System.out.println(user);
        request.getSession().setAttribute("user", user.toString());
        return "登录成功";
    }

    @RequestMapping(value = "quit")
    String doQuit(HttpServletRequest request) {
        request.getSession().removeAttribute("user");
        return "退出成功";
    }


}
